package com.cstor.liang.web.controller;

import com.cstor.liang.pojo.other.ResultJo;
import com.cstor.liang.pojo.entity.Role;
import com.cstor.liang.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2017/9/3.
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    private RoleService roleService;

    @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public ResultJo list() {
        //获取全部角色类型
        List<Role> list = roleService.getAllRole();
        //剔除 admin（管理员）角色
        list.removeIf(p -> p.getName().equals("admin"));

        return ResultJo.returnOk(list);
    }
}
